<?php
/**
 * 奖品表
 */
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateAwardHistoryTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('award_history', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('activity_id')->comment('活动ID');
            $table->integer('user_id')->comment('用户ID');
            $table->integer('award_id')->comment('奖品ID');
            $table->tinyInteger('status')->default(2)->comment('是否兑奖 1是 2否');
            $table->string('name')->nullable()->comment('奖品名称');
            $table->timestamp('draw_time')->nullable()->comment('兑奖时间');
            $table->text('data')->nullable()->comment('获奖时的操作参数');
            $table->text('draw_data')->nullable()->comment('领取信息  收货地址 手机等等');
            $table->string('award_name')->nullable()->comment('奖品名称---奖品下面有选择分类的情况填写');
            $table->string('mobile')->nullable()->comment('手机');
            $table->string('username')->nullable()->comment('领取联系人');
            $table->string('province')->nullable()->comment('省');
            $table->string('city')->nullable()->comment('市');
            $table->string('district')->nullable()->comment('区');
            $table->string('address')->nullable()->comment('详细地址');
            $table->timestamps();
            $table->softDeletes();
        });
        //添加表注释
        \Illuminate\Support\Facades\DB::statement("ALTER TABLE `".config('database.connections.mysql.prefix')."award_history` comment'历史中奖记录'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('award_history');
    }
}
